package com.bw.visitor.adapter

import android.graphics.Color
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import com.bw.visitor.R
import com.bw.visitor.entity.NameEntity
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

class NameAdapter: BaseQuickAdapter<NameEntity, BaseViewHolder>(R.layout.visitor_fen_item) {
    override fun convert(holder: BaseViewHolder, item: NameEntity) {
        holder.setText(R.id.v_fen_name, item.name)
        val constraintLayout = holder.getView<ConstraintLayout>(R.id.v_fen_id)
        val textView = holder.getView<TextView>(R.id.v_fen_name)
        if (item.isShow) {
            textView.setTextColor(Color.parseColor("#1E87E4"))
            constraintLayout.setBackgroundResource(R.drawable.xuan_yes)
        } else {
            textView.setTextColor(Color.parseColor("#56606D"))
            constraintLayout.setBackgroundResource(R.drawable.xuan_no)
        }
    }
}